import { Ref } from 'vue'
import { ElUtil, GetParentChildrenWidthType as ElUtilGetParentChildrenWidthType } from '@xtail/ui'

export const getParentChildrenWidth = (
  elRef: Ref<HTMLElement | null | undefined>
): ReturnType<ElUtilGetParentChildrenWidthType> => {
  if (!elRef.value)
    return {
      widthSum: 0,
      widthList: []
    }
  return ElUtil.getParentChildrenWidth(elRef.value)
}

export type GetParentChildrenWidthType = typeof getParentChildrenWidth
